<%-- 
    Document   : index
    Created on : 26-mrt-2012, 17:52:03
    Author     : BETA911
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="Connection.DataHandler" %>
<%@page import="java.sql.*" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Index</title>
    </head>
    <body>
        <h1>Hello database!</h1>
        <%
        DataHandler db = new DataHandler();
        out.println("<b>Xml file exist:</b> " + db.getXmlFileExists() +"</br>");
        out.println(db.getConnectionInfo() + "</br>");
        
        try {
            out.println("<b>Make a connection with database: </b>");
            db.startConnectie();
            out.println("Made a connection with the database.");
            out.println("</br>");
            out.println("<b>Selecting all known city's: </b>");
            ResultSet test = null;
            test = db.voerQueryUit("SELECT * FROM city");
            out.println("Gathered all the city info.");
            out.println("<table>");
            out.println("<tr>");
            while (test.next()){
                out.println("<td>" + test.getInt(1) + "</td>");
                out.println("<td>" + test.getString(1) + "</td>");
            }
            out.println("</tr>");
        } catch (Exception e){
            out.println("Some error happend...");
        }
        %>
    </body>
</html>
